Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kamil-kielczewski
Copy link
Contributor

More letters

More letters
@hazzik
Copy link
Contributor

hazzik commented Sep 9, 2020

There are many ways to get these letters. Why this particular way?

@kamil-kielczewski
Copy link
Contributor Author

kamil-kielczewski commented Sep 9, 2020

@hazzik This trick is non-trivial and allows to get RegExp without using any deprecated or semi-deprecated method (like escape)

Function("return"+(NaN+""["matchAll"]("")).slice(10,17))()("pattern")

after partial expansion:

[]["flat"]["constructor"]("return"+[10]["concat"](17)["reduce"](""["slice"]["bind"]((NaN+""["matchAll"]("")))))()("pattern")

but may be better place will be "Alternatives" section (?)

@hazzik
Copy link
Contributor

hazzik commented Sep 9, 2020

@kamil-kielczewski use split(" "):

Function("return "+(NaN+("")["matchAll"]()).split(" ")[1])

@kamil-kielczewski
Copy link
Contributor Author

Yep so we have

[]["flat"]["constructor"]("return "+([]+("")["matchAll"]())["split"](" ")[1])()("pattern")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants